import axios from "../utils/request.js"
import base from "./base.js"


const api = {
  getLogin(params) {
    return axios.post(base.baseUrl + base.login, params)
   },
   registration(params) {
    return axios.post(base.baseUrl + base.register, params)
   },
   send_email(params) {
    console.log(base.baseUrl + base.register+'?'+"name="+params)
    return axios.get(base.baseUrl + base.register+'?'+"name="+params)
   },
   get_capt() {
    return axios.get(base.baseUrl + base.captcha ,{responseType: 'blob'})
   },
   if_login() {
    return axios.get(base.baseUrl + base.if_login)
   },
   get_meaus(){
    return axios.get(base.baseUrl + base.meaus)
   },
   log_out() {
    return axios.post(base.baseUrl + base.log_out)
   },
   user_updata(params) {
    return axios.post(base.baseUrl + base.change_user_info,params)
   },
   user_upimg(params) {
    return axios.post(base.baseUrl + base.upload_img,params,{headers:{'Content-Type': 'multipart/form-data'}})
   },
   community_create(params) {
    return axios.post(base.baseUrl + base.upload_community_img,params,{headers:{'Content-Type': 'multipart/form-data'}})
   },
   get_user_community_list(params,page_size) {
    if(page_size == undefined) {
      return axios.get(base.baseUrl + base.get_user_community_list+'?'+"page="+params)
    }else{
      return axios.get(base.baseUrl + base.get_user_community_list+'?'+"page="+params+"&page_size="+page_size)
    }
   },
   del_user_community_list(id) {
    return axios.delete(base.baseUrl + base.del_user_community + id)
   },
   get_community_list(url) {
    return axios.get(base.baseUrl + base.get_community_list+"?"+url)
   },

   // 点赞
   like_community(id,orlike) {
      return axios.put(base.baseUrl + base.give_like+id+"/"+orlike)
   },
   // 评论动态
   create_Comment_user(params) {
    return axios.post(base.baseUrl + base.create_comment,params)
   },
   reset_pwd_get(params) {
    return axios.get(base.baseUrl + base.reset_pwd+"?"+'emeail='+params)
   },
   reset_pwd(params) {
    return axios.put(base.baseUrl + base.reset_pwd,params)
   },
}


export default api
